#ifndef __STRUGGLELAYER_H__
#define __STRUGGLELAYER_H__

#include "GameGlobal.h"
#include "VisibleRect.h"
#include "RectLayout.h"

#include <map>

#include "MapGrid.h"
#include "MapSlot.h"

#include "SpriteBrick.h"
#include "PeaShooter.h"
#include "bulletBall.h"

#include "GraveFactory.h"
#include "Zombie.h"

class StruggleLayer:public CCLayer,DragEvent
{
private:
	TSpriteBrickState				m_state;

	CCSprite*						m_dragSprite;
	string							m_dragSlotKey;

	map<string,PeaShooter*>*		m_attachedSprites;
	map<string,BulletBall*>*		m_attachedBulletBalls;
	map<unsigned int,Zombie*>*		m_zombies;
	GraveFactory*					m_graveFactory;


	void							CreatePeaShooterAndBullet( MapGrid* mapGrid, MapSlot* slot ) ;
public:
	StruggleLayer();
	~StruggleLayer();

	virtual bool					init(); 
	virtual void					onEnter();

	virtual void					touchBeginHandler(CCEvent*);
	virtual void					touchMoveHandler(CCPoint touchPoint,CCEvent*);
	virtual void					touchCompleteHandler(CCEvent*);
	void							DoStruggle( float dt );

	CREATE_FUNC(StruggleLayer);
};

#endif